#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int n;
	double height;
	char ch;
	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		getchar();  //收掉缓冲区剩下的\n
		scanf("%c %lf", &ch, &height);

		if (ch == 'M')
			printf("%.2lf\n", height / 1.09);
		else
			printf("%.2lf\n", height * 1.09);
	}
	return 0;
}